<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Title</title>
        <link rel="stylesheet" type="text/css" href="css/index.css" />
    </head>
    <body>
        <script type="text/javascript" src="js/index.js"></script>
        <h1>人事信息表</h1>
        <p>编写人:龙傲天</p>
    </body>
</html><!DOCTYPE html>
<html>
<head>
	<title>表格</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<style>
		table {
			border-collapse: collapse;
			width: 100%;
		}

		th, td {
			text-align: left;
			padding: 8px;
			border-bottom: 1px solid #ddd;
		}

		tr:hover {
			background-color: #f5f5f5;
		}

		th {
			background-color: #4CAF50;
			color: white;
		}
	</style>
</head>
<body>
	<h2>信息表格</h2>
	<table>
		<thead>
			<tr>
				<th>姓名</th>
				<th>身份证号</th>
				<th>电话号码</th>
				<th>地址</th>
				<th>其他信息</th>
			</tr>
		</thead>
		<tbody>
			<!-- 这里可以添加200行数据 -->
			<tr>
				<td contenteditable="true"></td>
				<td contenteditable="true"></td>
				<td contenteditable="true"></td>
				<td contenteditable="true"></td>
				<td contenteditable="true"></td>
			</tr>
			<!-- 重复上面的代码200次 -->
		</tbody>
	</table>

	<button onclick="exportToExcel()">导出Excel</button>

	<script>
		function exportToExcel() {
			let table = document.getElementsByTagName('table')[0];
			let html = table.outerHTML;
			let url = 'data:application/vnd.ms-excel;base64,';
			let blob = new Blob([html], { type: 'application/vnd.ms-excel' });
			let downloadLink = document.createElement("a");
			downloadLink.href = url + base64(html);
			downloadLink.download = "信息表格.xls";
			document.body.appendChild(downloadLink);
			downloadLink.click();
			document.body.removeChild(downloadLink);
		}

		function base64(s) {
			return window.btoa(unescape(encodeURIComponent(s)));
		}
	</script>
</body>
</html>
